<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>


        function getSum(n) {
            if (n % 2 == 0) {
                for (var i = 2, sum = 0; i <= n; i += 2) {
                    sum += 1 / i;
                }
            } else {
                for (var i = 1, sum = 0; i <= n; i += 2) {
                    sum += 1 / i;
                }
            }
            return sum;
        }
        console.log(getSum(202020202020))

    </script>
</body>

</html>